<layout name="layout" />
<div class="main-div">
    <table cellpadding="3" cellspacing="1" class="table table-hover">
        <thead style="background-color: skyblue;">
        <tr>
            <th >订单号</th>
            <th >商品名称</th>
            <th >商品图片</th>
            <th >商品规格</th>
            <th >商品数量</th>
            <th >商品单价</th>
        </tr>
        </thead>
        <tbody>
            <?php foreach($order['goods_list'] as $k=>$v):?>
                <tr>
                    <td><?php echo $v['order_id'];?></td>
                    <td><?php echo $v['goods_name'];?></td>
                    <td><img src="<?php echo showImg($v.sm_logo, 'goods/', 'logo/');?>"/></td>
                    <td>
                        <?php foreach($v['gaData'] as $k1=>$v1):?>
                            <?php echo $v1['attr_name']?>：<?php echo $v1['attr_value'];?><br/>
                        <?php endforeach;?>
                    </td>
                    <td><?php echo $v['goods_number'];?></td>
                    <td><?php echo $v['price'];?></td>
                </tr>
            <?php endforeach;?>
        </tbody>
    </table>

    <table cellpadding="3" cellspacing="1" class="table table-hover">
        <thead style="background-color: skyblue;">
            <th>收货人</th>
            <th>收货电话</th>
            <th>收货地址</th>
            <th>快递单号</th>
            <th>订单总价</th>
            <th>下单时间</th>
            <th>状态</th>
        </thead>
        <tbody>
        <tr>
            <td><?php echo $order['shr_name'];?></td>
            <td><?php echo $order['shr_tel'];?></td>
            <td><?php echo $order['shr_province'];?> <?php echo $order['shr_city'];?> <?php echo $order['shr_area'];?>
                <?php echo $order['shr_address'];?></td>
            <td><?php echo $order['post_number'];?></td>
            <td><span style="font-size: 20px;color: red;"><?php echo $order['total_price'];?></span></td>
            <td><?php echo date('Y-m-d H:i:s',$order['addtime']);?></td>
            <td>
                <?php if($order['status']=='是'):?>
                    <?php if($order['pay_status']=='是'):?>
                        <?php echo $order['post_status'] == 1 ? ('已发货') : ($order['post_status'] == 2 ? '已签收' : '未发货') ?>
                    <?php else:?>
                        <?php echo makeAilPayBtn($order['id']);?>
                    <?php endif;?>
                <?php else:?>
                    已取消
                <?php endif;?>
            </td>
        </tr>
        </tbody>
    </table>
    <form name="main_form" method="POST" action="__SELF__" enctype="multipart/form-data" >
        <table cellspacing="1" cellpadding="3" width="100%">
            <tr>
                <td class="label">
                    订单状态：
                </td>
                <td>
                    <select <?php if($order['order_status']==2):?>disabled<?php endif;?> name="order_status" class="form-control">
                        <option <?php if($order['order_status']=='正常'):?>selected<?php endif;?> value="正常">正常</option>
                        <option <?php if($order['order_status']=='关闭'):?>selected<?php endif;?> value="关闭">关闭</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td class="label">
                    支付状态：
                </td>
                <td>
                    <input disabled value="<?php echo $order['pay_status'] == '是' ? '已支付' : '未支付'; ?>" class="form-control"/>
                </td>
            </tr>
            <tr>
                <td class="label">
                    发货状态：
                </td>
                <td>
                    <select <?php if($order['post_status']==2):?>disabled<?php endif;?> name="post_status" class="form-control">
                        <option <?php if($order['post_status']==0):?>selected<?php endif;?> value="0">未发货</option>
                        <option <?php if($order['post_status']==1):?>selected<?php endif;?> value="1">已发货</option>
                        <option <?php if($order['post_status']==2):?>selected<?php endif;?> value="2">已签收</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td class="label">
                    快递单号：
                </td>

                <td>
                    <input <?php if($order['post_status']==2):?>disabled<?php endif;?> name="post_number" value="<?php echo $order['post_number'];?>"
                    type="text" class="form-control" placeholder="请输入快递单号！"/>
                </td>
            </tr>
            <?php if($order['post_status']==2):?>
                <tr colspan="2">
                    <td colspan="99" align="center">
                        <span style="font-size:30px;color:skyblue">该订单已交易完成！</span>
                    </td>
                </tr>
            <?php else:?>
                <tr>
                    <td class="label">
                    </td>
                    <td colspan="99" >
                        <input type="submit" class="btn btn-primary" value=" 确定 " />
                        <input type="reset" class="btn btn-default" value=" 重置 " />
                    </td>
                </tr>
            <?php endif;?>
            <input type="hidden" name="id" value="<?php echo $order['id']?>"/>
        </table>
    </form>
</div>